/**
 * Created by Weizehua on 2017/1/20.
 */
import {RequestService} from "../../core/RequestService";
import {Injectable} from "@angular/core";

@Injectable()
export class RegisterRequest {
    constructor(private request: RequestService) {
    }

    async isPhoneRegistered(phone: string): Promise<boolean> {
        let res = await this.request.get('/register/phone/isRegistered', {phone: phone});
        return res.status;
    }

    async getCaptcha(phone: string) {
        return await this.request.get('/register/phone/getCaptcha', {phone: phone});
    }

    async register(phone: string, password: string, captcha: string, captchaInfo: any) {
        await this.request.get('/register/phone',
            {
                phone: phone,
                password: password,
                captcha: captcha,
                captchaInfo: captchaInfo
            });
    }

}

